]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dash: Handle cancelled drags
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Mar 2011 15:56:08 +0000 (16:56 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 19 Mar 2011 10:16:10 +0000 (11:16 +0100)
If a drag was cancelled, do animations like size changes or zooming
out the remove target in parallel with the snapback animation.

https://bugzilla.gnome.org/show_bug.cgi?id=644324

js/ui/dash.js

index 6a39edc481e3789934681daaeb8eefa71283f531..ed22feab6928ad2b327c1d7d30e901928c15ae7e 100644 (file)
@@ -283,20 +283,37 @@ Dash.prototype = {
                               Lang.bind(this, this._onDragBegin));
         Main.overview.connect('item-drag-end',
                               Lang.bind(this, this._onDragEnd));
+        Main.overview.connect('item-drag-cancelled',
+                              Lang.bind(this, this._onDragCancelled));
         Main.overview.connect('window-drag-begin',
                               Lang.bind(this, this._onDragBegin));
+        Main.overview.connect('window-drag-cancelled',
+                              Lang.bind(this, this._onDragCancelled));
         Main.overview.connect('window-drag-end',
                               Lang.bind(this, this._onDragEnd));
     },
 
     _onDragBegin: function() {
+        this._dragCancelled = false;
         this._dragMonitor = {
             dragMotion: Lang.bind(this, this._onDragMotion)
         };
         DND.addDragMonitor(this._dragMonitor);
     },
 
+    _onDragCancelled: function() {
+        this._dragCancelled = true;
+        this._endDrag();
+    },
+
     _onDragEnd: function() {
+        if (this._dragCancelled)
+            return;
+
+        this._endDrag();
+    },
+
+    _endDrag: function() {
         this._clearDragPlaceholder();
         if (this._favRemoveTarget) {
             this._favRemoveTarget.actor.hide();